# -*- coding: utf-8 -*-
"""
| ==============================================
|
|   Copyright (c) 2025 Nuoyan
|
|   Author: Nuoyan
|   Email : 1279735247@qq.com
|   Gitee : https://gitee.com/charming-lee
|   Date  : 2025-08-27
|
| ==============================================
"""


from ..._core import _const


__all__ = [
    "ALL_CLIENT_ENGINE_EVENTS",
    "ALL_SERVER_ENGINE_EVENTS",
    "ALL_CLIENT_LIB_EVENTS",
    "ALL_SERVER_LIB_EVENTS",
    "ClientEventEnum",
    "ServerEventEnum",
]


ALL_CLIENT_ENGINE_EVENTS = {
    "UIDefReloadSceneStackAfter",
    "UpdatePlayerSkinClientEvent",
    "PlayerTryRemoveCustomContainerItemClientEvent",
    "PlayerTryAddCustomContainerItemClientEvent",
    "PlayerTryPutCustomContainerItemClientEvent",
    "PlayerPermissionChangeClientEvent",
    "HudButtonChangedClientEvent",
    "BlockAnimateRandomTickEvent",
    "PlayerAttackEntityEvent",
    "OnLocalPlayerActionClientEvent",
    "OnLocalPlayerStartJumpClientEvent",
    "GameRenderTickEvent",
    "GyroSensorChangedClientEvent",
    "ModBlockEntityTickClientEvent",
    "ModBlockEntityRemoveClientEvent",
    "AchievementButtonMovedClientEvent",
    "OnKeyboardControllerLayoutChangeClientEvent",
    "OnGamepadControllerLayoutChangeClientEvent",
    "OnGamepadTriggerClientEvent",
    "OnGamepadStickClientEvent",
    "OnGamepadKeyPressClientEvent",
    "ModBlockEntityLoadedClientEvent",
    "CloseNeteaseShopEvent",
    "PopScreenAfterClientEvent",
    "TapOrHoldReleaseClientEvent",
    "TapBeforeClientEvent",
    "RightClickReleaseClientEvent",
    "RightClickBeforeClientEvent",
    "OnMouseMiddleDownClientEvent",
    "OnKeyPressInGame",
    "OnClientPlayerStopMove",
    "OnClientPlayerStartMove",
    "OnBackButtonReleaseClientEvent",
    "MouseWheelClientEvent",
    "LeftClickReleaseClientEvent",
    "LeftClickBeforeClientEvent",
    "HoldBeforeClientEvent",
    "GetEntityByCoordReleaseClientEvent",
    "GetEntityByCoordEvent",
    "ClientJumpButtonReleaseEvent",
    "ClientJumpButtonPressDownEvent",
    "PlaySoundClientEvent",
    "PlayMusicClientEvent",
    "OnMusicStopClientEvent",
    "ScreenSizeChangedClientEvent",
    "PushScreenEvent",
    "PopScreenEvent",
    "PlayerChatButtonClickClientEvent",
    "OnItemSlotButtonClickedEvent",
    "GridComponentSizeChangedClientEvent",
    "ClientPlayerInventoryOpenEvent",
    "ClientPlayerInventoryCloseEvent",
    "ClientChestOpenEvent",
    "ClientChestCloseEvent",
    "WalkAnimEndClientEvent",
    "WalkAnimBeginClientEvent",
    "AttackAnimEndClientEvent",
    "AttackAnimBeginClientEvent",
    "StopUsingItemClientEvent",
    "StartUsingItemClientEvent",
    "PlayerTryDropItemClientEvent",
    "OnCarriedNewItemChangedClientEvent",
    "ItemReleaseUsingClientEvent",
    "InventoryItemChangedClientEvent",
    "GrindStoneRemovedEnchantClientEvent",
    "ClientShapedRecipeTriggeredEvent",
    "ClientItemUseOnEvent",
    "ClientItemTryUseEvent",
    "AnvilCreateResultItemAfterClientEvent",
    "ActorUseItemClientEvent",
    "ActorAcquiredItemClientEvent",
    "StepOnBlockClientEvent",
    "StartDestroyBlockClientEvent",
    "StepOffBlockClientEvent",
    "ShearsDestoryBlockBeforeClientEvent",
    "PlayerTryDestroyBlockClientEvent",
    "OnStandOnBlockClientEvent",
    "OnModBlockNeteaseEffectCreatedClientEvent",
    "OnEntityInsideBlockClientEvent",
    "OnAfterFallOnBlockClientEvent",
    "FallingBlockCauseDamageBeforeClientEvent",
    "ClientBlockUseEvent",
    "PerspChangeClientEvent",
    "OnPlayerHitBlockClientEvent",
    "GameTypeChangedClientEvent",
    "ExtinguishFireClientEvent",
    "DimensionChangeFinishClientEvent",
    "DimensionChangeClientEvent",
    "CameraMotionStopClientEvent",
    "CameraMotionStartClientEvent",
    "LeaveEntityClientEvent",
    "StartRidingClientEvent",
    "OnMobHitMobClientEvent",
    "OnGroundClientEvent",
    "HealthChangeClientEvent",
    "EntityStopRidingEvent",
    "EntityModelChangedClientEvent",
    "ApproachEntityClientEvent",
    "UnLoadClientAddonScriptsBefore",
    "RemovePlayerAOIClientEvent",
    "RemoveEntityClientEvent",
    "OnLocalPlayerStopLoading",
    "OnCommandOutputClientEvent",
    "LoadClientAddonScriptsAfter",
    "ChunkLoadedClientEvent",
    "ChunkAcquireDiscardedClientEvent",
    "AddPlayerCreatedClientEvent",
    "AddPlayerAOIClientEvent",
    "AddEntityClientEvent",
    "OnScriptTickClient",
    "UiInitFinished",
}
ALL_SERVER_ENGINE_EVENTS = {
    "ItemPullOutCustomContainerServerEvent",
    "ItemPushInCustomContainerServerEvent",
    "PlayerPermissionChangeServerEvent",
    "PlayerTryRemoveCustomContainerItemServerEvent",
    "PlayerTryAddCustomContainerItemServerEvent",
    "PlayerTryPutCustomContainerItemServerEvent",
    "MountTamingEvent",
    "OnPlayerActionServerEvent",
    "CustomCommandTriggerServerEvent",
    "GlobalCommandServerEvent",
    "PlayerPickupArrowServerEvent",
    "EntityDieLoottableAfterServerEvent",
    "PlayerHungerChangeServerEvent",
    "ItemDurabilityChangedServerEvent",
    "PlaceNeteaseLargeFeatureServerEvent",
    "PlayerNamedEntityServerEvent",
    "PlayerFeedEntityServerEvent",
    "lobbyGoodBuySucServerEvent",
    "UrgeShipEvent",
    "PlayerInventoryOpenScriptServerEvent",
    "WalkAnimEndServerEvent",
    "WalkAnimBeginServerEvent",
    "JumpAnimBeginServerEvent",
    "AttackAnimEndServerEvent",
    "AttackAnimBeginServerEvent",
    "UIContainerItemChangedServerEvent",
    "ShearsUseToBlockBeforeServerEvent",
    "ServerPlayerTryTouchEvent",
    "ServerItemTryUseEvent",
    "PlayerDropItemServerEvent",
    "OnPlayerBlockedByShieldBeforeServerEvent",
    "OnPlayerBlockedByShieldAfterServerEvent",
    "OnPlayerActiveShieldServerEvent",
    "OnOffhandItemChangedServerEvent",
    "OnNewArmorExchangeServerEvent",
    "OnItemPutInEnchantingModelServerEvent",
    "ItemUseOnAfterServerEvent",
    "ItemUseAfterServerEvent",
    "ItemReleaseUsingServerEvent",
    "InventoryItemChangedServerEvent",
    "FurnaceBurnFinishedServerEvent",
    "CraftItemOutputChangeServerEvent",
    "ContainerItemChangedServerEvent",
    "StepOnBlockServerEvent",
    "StepOffBlockServerEvent",
    "StartDestroyBlockServerEvent",
    "ShearsDestoryBlockBeforeServerEvent",
    "ServerPlayerTryDestroyBlockEvent",
    "ServerPlaceBlockEntityEvent",
    "ServerEntityTryPlaceBlockEvent",
    "ServerBlockEntityTickEvent",
    "PistonActionServerEvent",
    "OnStandOnBlockServerEvent",
    "OnBeforeFallOnBlockServerEvent",
    "OnAfterFallOnBlockServerEvent",
    "HopperTryPullOutServerEvent",
    "HopperTryPullInServerEvent",
    "HeavyBlockStartFallingServerEvent",
    "GrassBlockToDirtBlockServerEvent",
    "FarmBlockToDirtBlockServerEvent",
    "FallingBlockReturnHeavyBlockServerEvent",
    "FallingBlockCauseDamageBeforeServerEvent",
    "FallingBlockBreakServerEvent",
    "EntityPlaceBlockAfterServerEvent",
    "DirtBlockToGrassBlockServerEvent",
    "CommandBlockUpdateEvent",
    "CommandBlockContainerOpenEvent",
    "ChestBlockTryPairWithServerEvent",
    "BlockStrengthChangedServerEvent",
    "BlockSnowStateChangeServerEvent",
    "BlockSnowStateChangeAfterServerEvent",
    "BlockRemoveServerEvent",
    "BlockRandomTickServerEvent",
    "BlockNeighborChangedServerEvent",
    "BlockLiquidStateChangeServerEvent",
    "BlockLiquidStateChangeAfterServerEvent",
    "BlockDestroyByLiquidServerEvent",
    "StoreBuySuccServerEvent",
    "ServerPlayerGetExperienceOrbEvent",
    "PlayerTrySleepServerEvent",
    "PlayerTeleportEvent",
    "PlayerStopSleepServerEvent",
    "PlayerSleepServerEvent",
    "PlayerRespawnFinishServerEvent",
    "PlayerRespawnEvent",
    "PlayerHurtEvent",
    "PlayerEatFoodServerEvent",
    "PlayerDieEvent",
    "OnPlayerHitBlockServerEvent",
    "GameTypeChangedServerEvent",
    "ExtinguishFireServerEvent",
    "DimensionChangeServerEvent",
    "ChangeLevelUpCostServerEvent",
    "AddLevelEvent",
    "AddExpEvent",
    "WillTeleportToServerEvent",
    "WillAddEffectServerEvent",
    "StartRidingServerEvent",
    "RemoveEffectServerEvent",
    "RefreshEffectServerEvent",
    "ProjectileCritHitEvent",
    "OnMobHitMobServerEvent",
    "OnKnockBackServerEvent",
    "OnFireHurtEvent",
    "MobGriefingBlockServerEvent",
    "HealthChangeServerEvent",
    "EntityTickServerEvent",
    "EntityPickupItemServerEvent",
    "EntityMotionStopServerEvent",
    "EntityMotionStartServerEvent",
    "EntityLoadScriptEvent",
    "EntityEffectDamageServerEvent",
    "EntityDroppedItemServerEvent",
    "EntityChangeDimensionServerEvent",
    "ChangeSwimStateServerEvent",
    "AddEffectServerEvent",
    "ActorHurtServerEvent",
    "ServerSpawnMobEvent",
    "ServerPreBlockPatternEvent",
    "ServerPostBlockPatternEvent",
    "ServerChatEvent",
    "PlayerLeftMessageServerEvent",
    "PlayerJoinMessageEvent",
    "PlayerIntendLeaveServerEvent",
    "PlaceNeteaseStructureFeatureEvent",
    "OnRainLevelChangeServerEvent",
    "OnLocalRainLevelChangeServerEvent",
    "OnLocalLightningLevelChangeServerEvent",
    "OnLightningLevelChangeServerEvent",
    "OnContainerFillLoottableServerEvent",
    "OnCommandOutputServerEvent",
    "NewOnEntityAreaEvent",
    "LoadServerAddonScriptsAfter",
    "DelServerPlayerEvent",
    "CommandEvent",
    "ClientLoadAddonsFinishServerEvent",
    "ChunkLoadedServerEvent",
    "ChunkGeneratedServerEvent",
    "ChunkAcquireDiscardedServerEvent",
    "AddServerPlayerEvent",
    "AchievementCompleteEvent",
    "PlayerAttackEntityEvent",
    "ServerBlockUseEvent",
    "OnGroundServerEvent",
    "SpawnProjectileServerEvent",
    "EntityDieLoottableServerEvent",
    "ActuallyHurtServerEvent",
    "HealthChangeBeforeServerEvent",
    "DimensionChangeFinishServerEvent",
    "EntityDefinitionsEventServerEvent",
    "PlayerDoInteractServerEvent",
    "PlayerInteractServerEvent",
    "MobDieEvent",
    "AddEntityServerEvent",
    "OnMobHitBlockServerEvent",
    "OnEntityInsideBlockServerEvent",
    "EntityStartRidingEvent",
    "EntityStopRidingEvent",
    "ServerItemUseOnEvent",
    "ActorUseItemServerEvent",
    "ActorAcquiredItemServerEvent",
    "DestroyBlockEvent",
    "DamageEvent",
    "ExplosionServerEvent",
    "ProjectileDoHitEffectEvent",
    "OnCarriedNewItemChangedServerEvent",
    "EntityRemoveEvent",
    "OnScriptTickServer",
}
ALL_CLIENT_LIB_EVENTS = {}
ALL_SERVER_LIB_EVENTS = {
    'ItemGridChangedServerEvent': _const.LIB_CLIENT_NAME,
    'UiInitFinished': _const.LIB_CLIENT_NAME,
}


class __EventEnum:
    def __init__(self, pool, is_client):
        self.pool = pool
        self.is_client = is_client

    def __getattr__(self, item):
        if item not in self.pool:
            from .._error import EventNotFoundError
            raise EventNotFoundError(item, self.is_client)
        return item


ClientEventEnum = __EventEnum(ALL_CLIENT_ENGINE_EVENTS.union(ALL_CLIENT_LIB_EVENTS), True)
ServerEventEnum = __EventEnum(ALL_SERVER_ENGINE_EVENTS.union(ALL_SERVER_LIB_EVENTS), False)


def __test__():
    assert ClientEventEnum.ClientBlockUseEvent == "ClientBlockUseEvent"
    assert ServerEventEnum.DamageEvent == "DamageEvent"
    def f():
        ClientEventEnum.ABC
    from .._utils import assert_error
    from .._error import EventNotFoundError
    assert_error(f, (), EventNotFoundError)






